1. Field of the Invention
This invention relates to power management for computer systems and, more particularly, to restoration of wakeup event enablement after a computer system suffers a power loss.
2. Description of the Related Art
Many computer systems, including personal computers, workstations, servers, and embedded systems are designed to have multiple peripheral devices included in the system. A typical personal computer system includes a processor, associated memory and control logic and a number of peripheral devices that provide input and output (I/O) for the system. Such peripheral devices include, for example, compact disk read-only memory (CD-ROM) drives, hard disk drives, floppy disk drives, and other mass storage devices such as tape drives, compact disk recordable (CD-R) drives or digital video/versatile disk (DVD) drives. Additionally, the underlying circuitry of computer systems including processors, graphics chips, memories, and control logic are continually becoming more complex and feature-rich. However, computer systems having some or all of these characteristics tend to consume great amounts of power.
To reduce power consumption, various components of a computer system can be placed into a variety of different power states with differing levels of power consumption. For example, video output from a computer system, processor operation, and hard disk drive rotation can be deactivated during periods of system inactivity. More sophisticated power management schemes have been developed and implemented as industry standards including the Advanced Power Management APM) Specification described in the Advanced Power Management (APM) BIOS interface Specification, Revision 1.2, dated February, 1996, and the Advanced configuration and Power Interface (ACPI) standard described in the Advanced configuration and Power Interface Specification, Revision 1.0, dated Dec. 22, 1996, both of which are hereby incorporated herein, in there entirety, by reference.
Such standards define a variety of operational states depending upon system activity and the amount of power being consumed. For example, the ACPI specification defines six "sleeping" states S0-S5. In the S0 state (also known as the G0 state) the computer system is fully on and operational, consuming maximum power. In the S5 state (also known as the soft-off state) the computer system consumes a minimal amount of power. No code is executed in the computer system, almost all devices are inactive, and the computer system awaits a wakeup event to transition it to a higher activity state. Awakening from the soft-off state requires a complete boot of the computer system because no system context is saved prior to entering S5. The sleep states between S0 and S5 each specify varying amounts of component activity and therefore power consumption. States S1-S4 may have differing wakeup latency times depending upon which devices are inactive, how much computer system context was saved prior to entering the sleep state, and other factors. Power management schemes like APM and ACPI need not have multiple sleep states, but may simply have a fully on state and a state of lower power consumption, such as a soft-off power state.
A computer system can be configured to wake from the soft-off sleep state in response to a variety of different wakeup events including, for example: (1) a user pressing a power on or resume button; (2) wakeup on local area network (LAN) where the computer system's LAN adapter or network interface card (NIC) monitors network traffic for a wakeup signal such as a Magic Packets.TM.; (3) wakeup on realtime clock (RTC) alarm; (4) wakeup on lid, where opening the lid of a portable computer generates the wakeup event; and (5) wakeup on ring indicated (RI) where a modem asserts its RI line when it detects a ring on the phone line.
System support for these wakeup events is usually implemented in a power management circuit that is part of the computer system's core logic chipset One example of a core logic chip that includes power management circuitry is available from Intel Corporation under the trade designation 82371 AB PCI-to-ISA/IDE Xcelerator (PIIX4). The PIIX4 supports wakeup from soft-off events by maintaining power to its suspend well logic and monitoring appropriate registers, while power to the rest of the chip (and most or all of the rest of the computer system) is removed. In one example of enabling a computer system using the PIIX4 to transition from the soft-off state to the fill on power state after a wakeup on LAN event, bit 9 of the PIIX4's General Purpose Enable Register (GPEN) is set to 1. With wakeup on LAN thus enabled, when the PIIX4 receives an appropriate signal from the attached network, bit 9 of the General Purpose Status Register (GPSTS) is asserted and the computer system begins the transition to the fully on power state.
As the example of the PIIX4 illustrates, when the system is in the soft-off state, it appears to a user that the system is off, even though some power management circuitry is still powered and monitoring inputs, such as the power button, to determine if the system should be turned on. Typically, a user first selects desired wakeup events via a system setup utility, which stores appropriate settings in a nonvolatile memory (usually a battery backed static random access memory (SRAM)) so that the computer system's basic input output system (BIOS) can restore the settings each time the computer system performs a complete boot and/or when the computer system performs a normal shutdown (e.g. a transition to the soft-off power state).
However, if an invalid shutdown event occurs (e.g. a power loss due to AC power failure), and power is removed from the system, those sections of the power management circuitry responsible for monitoring wakeup events are no longer powered, and hence the system loses its memory of which wakeup events the user wanted enabled. After power restoration, the computer system would not respond to the previously enabled wakeup events, creating confusion because of unexpected system behavior and/or requiring for the user specifically re-enable the desired wakeup events.
Additionally, many power management systems for computer systems are designed so that the default action when power is restored is to power the system on. Since powering the system on as soon as power is available (e.g. when the computer system is plugged in, or when AC power is restored) is undesirable behavior to a user, the computer system's BIOS determines, after each power on event, if the event that caused the power on was a valid event (e.g. power button pressed, or a wakeup event) or an invalid event (e.g. AC was restored after a power loss). If the event was invalid, the power state prior to the invalid event is restored. Where the prior power state was soft-off, as in the example above, no additional boot process is required, and the computer system can be placed in soft-off quite quickly, with minimal effort and no user input
Under these circumstances, the computer system is restored to the soft-off state, but the wakeup event is not enabled. Accordingly, it is desirable to have a BIOS program or circuit that can restore enabled wakeup events and return a computer system to its previous power state without requiring unnecessary execution of the boot process.